Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] [doc] Added solutions for debezium-source-mysql connection errors #649

Merged
merged 6 commits into from
Jul 31, 2023

Conversation

poorbarcode
Copy link
Contributor

@poorbarcode poorbarcode commented Jul 20, 2023

When MySQL enabled caching_sha2_password_auto_generate_rsa_keys , the debezium will get an error: Public Key Retrieval is not allowed

2023-07-20T18:28:41,740+0800 [function-timer-thread-34-1] ERROR org.apache.pulsar.functions.runtime.RuntimeSpawner - public/default/debezium-mysql-source Function Container is dead with following exception. Restarting.
io.debezium.DebeziumException: Unexpected error while connecting to MySQL and looking at BINLOG_FORMAT mode: 
	at io.debezium.connector.mysql.MySqlConnection.isBinlogFormatRow(MySqlConnection.java:385) ~[?:?]
	at io.debezium.connector.mysql.MySqlConnectorTask.validateBinlogConfiguration(MySqlConnectorTask.java:240) ~[?:?]
	at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:85) ~[?:?]
	at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:133) ~[?:?]
	at org.apache.pulsar.io.kafka.connect.AbstractKafkaConnectSource.open(AbstractKafkaConnectSource.java:162) ~[?:?]
	at org.apache.pulsar.io.kafka.connect.KafkaConnectSource.open(KafkaConnectSource.java:63) ~[?:?]
	at org.apache.pulsar.io.debezium.DebeziumSource.open(DebeziumSource.java:114) ~[?:?]
	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.setupInput(JavaInstanceRunnable.java:858) ~[org.apache.pulsar-pulsar-functions-instance-3.0.0.jar:3.0.0]
	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.setup(JavaInstanceRunnable.java:253) ~[org.apache.pulsar-pulsar-functions-instance-3.0.0.jar:3.0.0]
	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:290) ~[org.apache.pulsar-pulsar-functions-instance-3.0.0.jar:3.0.0]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[?:?]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[?:?]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:244) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:888) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:883) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:636) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:510) ~[?:?]
	at io.debezium.connector.mysql.MySqlConnection.isBinlogFormatRow(MySqlConnection.java:380) ~[?:?]
	... 10 more
Caused by: com.mysql.cj.exceptions.UnableToConnectException: Public Key Retrieval is not allowed
	at jdk.internal.reflect.GeneratedConstructorAccessor33.newInstance(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[?:?]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85) ~[?:?]
	at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:130) ~[?:?]
	at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:49) ~[?:?]
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:447) ~[?:?]
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:212) ~[?:?]
	at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1433) ~[?:?]
	at com.mysql.cj.NativeSession.connect(NativeSession.java:133) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[?:?]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[?:?]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:244) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:888) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:883) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:636) ~[?:?]
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:510) ~[?:?]
	at io.debezium.connector.mysql.MySqlConnection.isBinlogFormatRow(MySqlConnection.java:380) ~[?:?]
	... 10 more

Add a solution to solve the issue

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@poorbarcode poorbarcode self-assigned this Jul 20, 2023
@poorbarcode poorbarcode added the doc Improvements or additions to documentation label Jul 20, 2023
@poorbarcode poorbarcode added this to the 3.1.0 milestone Jul 20, 2023
@Anonymitaet
Copy link
Member

Anonymitaet commented Jul 21, 2023

@Technoboy- Could you please help review this PR from a technical perspective? Then writers will review it from a technical writing side. Thank you!

@Anonymitaet
Copy link
Member

ping @Technoboy-

Copy link
Contributor

@Technoboy- Technoboy- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some updates after discussion with @poorbarcode

@poorbarcode
Copy link
Contributor Author

@Technoboy-

Need some updates after discussion with @poorbarcode

Done

Copy link
Member

@Anonymitaet Anonymitaet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

  1. Have you previewed your changes and ensured everything goes as expected?

    If not, please preview your changes locally and attach the screenshots to this PR.

    In this way, you can get your PR merged more quickly.

  2. Please apply the same changes to all versions.

docs/io-cdc-debezium.md Outdated Show resolved Hide resolved
docs/io-cdc-debezium.md Outdated Show resolved Hide resolved
docs/io-cdc-debezium.md Outdated Show resolved Hide resolved
# if the plugin of mysql.user is is "caching_sha2_password", set it to "mysql_native_password".
alter user '{user}'@'{host}' identified with mysql_native_password by {password};

# check the plugin of mysql.user.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# check the plugin of mysql.user.
# Check the plugin of mysql.user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -220,6 +220,35 @@ This example shows how to change the data of a MySQL table using the Pulsar Debe

6. A MySQL client pops out.

Change the connection mode to `mysql_native_password`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Change the connection mode to `mysql_native_password`
Change the connection mode to `mysql_native_password`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

| caching_sha2_password_auto_generate_rsa_keys | ON |
+----------------------------------------------+-------+

# if the value of "caching_sha2_password_auto_generate_rsa_keys" is ON, ensure the plugin of mysql.user is "mysql_native_password".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# if the value of "caching_sha2_password_auto_generate_rsa_keys" is ON, ensure the plugin of mysql.user is "mysql_native_password".
# If the value of "caching_sha2_password_auto_generate_rsa_keys" is ON, ensure the plugin of mysql.user is "mysql_native_password".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

| localhost | root | caching_sha2_password |
+-----------+------+-----------------------+

# if the plugin of mysql.user is is "caching_sha2_password", set it to "mysql_native_password".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# if the plugin of mysql.user is is "caching_sha2_password", set it to "mysql_native_password".
# If the plugin of mysql.user is is "caching_sha2_password", set it to "mysql_native_password".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# if the plugin of mysql.user is is "caching_sha2_password", set it to "mysql_native_password".
alter user '{user}'@'{host}' identified with mysql_native_password by {password};

# check the plugin of mysql.user.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# check the plugin of mysql.user.
# Check the plugin of mysql.user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@poorbarcode
Copy link
Contributor Author

@Anonymitaet

Have you previewed your changes and ensured everything goes as expected?
If not, please preview your changes locally and attach the screenshots to this PR.

截屏2023-07-27 10 47 01

Please apply the same changes to all versions.

Done

@Anonymitaet Anonymitaet merged commit a76db75 into apache:main Jul 31, 2023
2 checks passed
@Technoboy- Technoboy- mentioned this pull request Aug 9, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants